home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir42 / doslbs.zip / DOSLIB01.CLA < prev    next >
Text File  |  1994-01-31  |  7KB  |  123 lines

  1.                    Member('DOSLIB')
  2. OMIT('╝')
  3. ╔════════════════════════════════════════════════════════════════════════════╗
  4. ║ Change_Directory -                             !Generated Procedure        ║
  5. ╚════════════════════════════════════════════════════════════════════════════╝
  6.  
  7. Change_Directory   PROCEDURE
  8.  
  9. Directory          STRING(64)
  10. Old_Directory      String(64)
  11.  
  12. DirQueue           QUEUE
  13. DirLine              STRING(15)
  14.                    .
  15.  
  16. SCREEN           SCREEN(11,61),PRE(SCR),SHADOW,EXPAND(7),ZOOM,CUA,COLOR(1)
  17.                    !style=D:\CLARION\DEVELOP\DOSLIB\CLARION.STY
  18.                    ROW(6,11)   PAINT(1,1),COLOR(113)
  19.                    ROW(1,1)    STRING('█{22}'),COLOR(113)
  20.                      COL(23)   STRING('Change Directory'),COLOR(2)
  21.                      COL(39)   STRING('█{23}'),COLOR(113)
  22.                    ROW(6,4)    STRING('Current'),COLOR(113)
  23.                      COL(14)   STRING(':'),COLOR(113)
  24.                    ROW(11,1)   STRING('█▄{59}█'),COLOR(113)
  25.                                REPEAT(9)
  26.                    ROW(2,1)      STRING('█'),COLOR(113)
  27.                    ROW(2,61)     STRING('█'),COLOR(113)
  28.                                .
  29.                    ROW(4,4)    PROMPT('Switch To :'),COLOR(4,5,40,6,7)
  30.                      COL(15)   ENTRY(@s28),USE(Directory),COLOR(8,9,38)
  31.                    ROW(6,15)   ENTRY(@s28),USE(Old_Directory),SKIP,COLOR(8,9,38)
  32.                    ROW(3,45)   LIST(7,14),FROM(DirLine),VSCROLL,USE(?DirList),IMM,COLOR(21,22,68)
  33.                    ROW(9,9)    BUTTON(' &Change |'),SHADOW,USE(?Change),COLOR(17,18,39,19,20)
  34.                      COL(31)   BUTTON('  &Exit  |'),SHADOW,KEY(EscKey),USE(?Cancel),COLOR(17,18,39,19,20)
  35.                  .
  36.  
  37. DirString          CSTRING(64)                        !Used for Directory to search
  38. SaveDir            LIKE(DirString)                    !Used to hold beginning path
  39.  
  40. DirInfo            GROUP                              !Necessary DOS file group
  41.                      BYTE,DIM(21)                     ! Used by findfirst
  42. Attrib               BYTE                             ! Attribute in DOS format
  43. DosTime              SHORT                            ! Time in DOS format
  44. DosDate              SHORT                            ! Date in DOS format
  45. Filesize             LONG                             ! Size in BYTES
  46. FileName             CSTRING(13)                      ! File name
  47.                    END                                !End GROUP
  48.  
  49.  
  50.   CODE
  51.   OPEN(Screen)                                   !Open the screen
  52.   SaveDir = PATH()                               !Save the Starting Directory
  53.   IF LEN(CLIP(SaveDir)) <> 3                     !If not in the root directory
  54.     SaveDir = CLIP(SaveDir) & '\'                ! Add the trailing '\'
  55.   END                                            !End IF
  56.   Directory     = SaveDir                        !Set to the Current Directory
  57.   Old_Directory = SaveDir
  58.   DO FillQueues                                  !Fill the screen queues
  59.   LOOP                                           !Main ACCEPT loop
  60.     ACCEPT                                       ! ACCEPT keyboard input
  61.     CASE FIELD()                                 ! Jump to field edit routine
  62.  
  63.     OF ?DirList                                  ! Directory list field edit
  64.       IF SELECTED() = ?DirList                   !  If staying on this field
  65.         IF KEYCODE() = MouseLeft2 OR |           !   On mouse double click
  66.            KEYCODE() = EnterKey                  !     or the Enter Key
  67.           GET(DirQueue,CHOICE())                 !    Get the selected entry
  68.           Directory = CLIP(Directory)&DirLine    ! Create a new directory
  69.           SETPATH(Directory)                     !    Set to the directory
  70.           Directory = PATH()                     !     Reread the directory
  71.           IF LEN(CLIP(Directory)) <> 3           !    If not in the Root
  72.             Directory = CLIP(Directory) & '\'    !       add the trailing \
  73.           END                                    !    End IF
  74.           Do FillQueues                          !    Fill the screen queues
  75.           SELECT(?DirList,1)                     !    Reset Dir List box
  76.         END                                      !   End IF
  77.       END                                        !  End IF
  78.  
  79.     OF ?Change                                   ! Ok button field Edit
  80.       Old_Directory = Path()                     ! Break out of screen LOOP
  81.       SaveDir       = Path()
  82.       Display
  83.       Select(?Directory)
  84.  
  85.     OF ?Cancel                                   ! Cancel button field Edit
  86.       SETPATH(SaveDir)                           !  Return to starting path
  87.       FREE(DirQueue)                             !  Free the DirQueue memory
  88.       BREAK                                      !  Return to calling procedure
  89.     END                                          ! End CASE FIELD()
  90.   END                                            !End LOOP
  91.   FREE(DirQueue)                                 !Free the DirQueue memory
  92.  
  93. FillQueues  ROUTINE
  94.  
  95.   FREE(DirQueue)                                 !Free the DirQueue
  96.   DirString = CLIP(Directory) & '*.*'            !Set the subdirectory mask
  97.   IF NOT LEN(CLIP(DirString)) = 6                !If not in the root directory
  98.     DirLine = '..\'                              ! Make prior directory entry
  99.     ADD(DirQueue)                                ! Add to the DirQueue
  100.   END                                            !End IF
  101.   IF DL:FindFirst(DirString,DirInfo,FA_DIREC) <> 0 !If unexpected error
  102.     FREE(DirQueue)                               ! Clear the DirQueue
  103.     RETURN                                       ! Return
  104.   END                                            !End IF
  105.   LOOP                                           !While entries found
  106.     IF FileName = '.' OR FileName = '..'         ! If the dot entries
  107.       IF DL:FindNext(DirInfo) <> 0               !   Get the next entry
  108.         BREAK                                    !   Break if unexpected error
  109.       END                                        !  End IF
  110.       CYCLE                                      !  Return to dot entry check
  111.     END                                          ! End IF
  112.     IF BAND(ATTRIB,10H)                          ! If a subdirectory is found
  113.       DirLine = FileName                         !  Fill the queue field
  114.       ADD(DirQueue)                              !  Add to the DirQueue
  115.       IF ERRORCODE() THEN BREAK.                 !  Break if unexpected error
  116.     END                                          ! End IF
  117.     IF DL:FindNext(DirInfo) <> 0                 ! Get the next entry
  118.       BREAK                                      !  Break if unexpected error
  119.     END                                          ! End IF
  120.   END                                            !End LOOP
  121.   SORT(DirQueue,+DirLine)                        !Sort the directory listing
  122.   DISPLAY                                        !Display the new lists
  123.